<?php

    class lpu
    {
        public $server;
        public $name;
        public $name2;
    }

    // Результаты записи
    class lpu_class
    {
        
        public $lpu = Array();

        public function __construct()
        {
            #Читаем данные из ini файла 
            $ini_data = parse_ini_file(dirname(__FILE__)."/config.ini", true);
            if(isset($ini_data['options']) && isset($ini_data['options']['lpu']))
            {
                $options = $ini_data['options'];
                $lpu_collection_string = $options['lpu'];
                $lpu = explode(",", $lpu_collection_string);
                foreach($lpu as $lpu_section_name)
                {
                    if(isset($ini_data[$lpu_section_name]))
                    {
                        $this->LoadLpuFromSection($ini_data[$lpu_section_name]);
                    }
                }
            }
        }
        
        private function LoadLpuFromSection($section)
        {
            if(isset($section['server']) && isset($section['name']) && isset($section['name2']))
            {
                $newlpu = new lpu();
                $newlpu->server = $section['server'];
                $newlpu->name = $section['name'];
                $newlpu->name2 = $section['name2'];
                $this->lpu[$newlpu->server] = $newlpu;
            }
        }
        
        public function items()
        {
            return $this->lpu;
        }

    }

?>